package com.wing.cabinet.model.response;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.cabinet.model.entity.CabinetCargoSpace;
import com.wing.cabinet.model.entity.StorageInventoryInout;
import com.wing.cabinet.model.entity.StorageInventoryInoutDetail;
import com.wing.cabinet.utils.ExcelExport;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 暂存柜存刀/取刀;存/取维修/回收刀VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class OldNewStorageExportVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @ExcelExport(value = "存入时间",sort = 180)
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    @ExcelExport(value = "存入人",sort = 170)
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;



    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 操作类型
     */
    private StorageInventoryInout.OperationType operationType;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String operationTypeDesc;

    public String getOperationTypeDesc() {
        return operationType.getDesc();
    }

    /**
     * 业务类型
     */
    private StorageInventoryInout.BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType.getDesc();
    }

    /**
     * 状态
     */
    private StorageInventoryInout.Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status.getDesc();
    }

    /**
     * 盘验时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime checkTime;

    /**
     * 盘验人id
     */
    private Long checkUserId;

    /**
     * 盘验人
     */
    private String checkUserName;

    /**
     * 通知时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime notifyTime;

    /**
     * 通知人
     */
    private Long notifyUserId;

    /**
     * 通知人
     */
    private String notifyUserName;

    /**
     * 回收人id
     */
    private Long takeUserId;

    /**
     * 回收人
     */
    private String takeUserName;

    /**
     * 回收时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime takeTime;

    /**
     * 暂存柜存刀id
     */
    private Long inoutId;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
   @ExcelExport(value = "物料数量(包装计)",sort = 110)
    private Integer quantity;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 货道id
     */
    private Long spaceId;
    @ExcelExport(value = "以旧换新编号",sort = 60)
    private String oldNewCode;
    /**
     * 存刀任务编号
     */
    @ExcelExport(value = "存入记录编号",sort = 70)
    private String code;

    @ExcelExport(value = "存入方式",sort = 80)
    private String inType = "暂存";

    /**
     * 柜子编号
     */
    @ExcelExport(value = "柜子编号",sort = 90)
    private String cabCode;

    /**
     * sku 编号
     */
    @ExcelExport(value = "物料编号",sort = 20)
    private String skuCode;

    /**
     * 货道编号
     */
    @ExcelExport(value = "货位编号",sort = 100)
    private String spaceCode;

    /**
     * 当前库存
     */
    private Integer quantityCurrent;

    /**
     * 变动后库存
     */
    private Integer quantityAfter;

    /**
     * 产品sku名称
     */
    @ExcelExport(value = "物料名称",sort = 10)
    private String skuName;


    /**
     * 业务类型
     */
    private StorageInventoryInout.BusinessTypeChecked businessTypeChecked;


    private String businessTypeCheckedDesc;

    public String getBusinessTypeCheckedDesc(){
        if (businessTypeChecked!=null){
            return businessTypeChecked.getDesc();
        }
        return null;
    }





    /**
     * 产品规格
     */
    private String skuSpec;



    /**
     * sku 图片
     */
    private String skuPic;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品类型名称
     */
    private String productTypeName;

    /**
     * 产品分类名称
     */
    private String productCategoryName;

    /**
     * 产品品牌
     */
    @ExcelExport(value = "品牌",sort = 40)
    private String productBrandName;

    /**
     * 产品型号
     */
    private String productModelName;

    /**
     * 适配机床
     */
    private String deviceName;

    /**
     * 市场价
     */
    private BigDecimal marketPrice;

    private Integer quantityMax;

    /**
     * 单位
     */
    @ExcelExport(value = "包装单位",sort = 111)
    private String unitName;


    /**
     * 签收人id
     */
    private Long signUserId;

    /**
     * 签收人
     */
    private String signUserName;

    /**
     * 签收时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime signTime;

    /**
     * 维修厂商
     */
    private String repairCompany;

    private Long checkedResultId;

    private String workshopName;

    private String floor;

    /**
     * 供应商id
     */
    private Long supplierId;

    /**
     * 供应商名称
     */
    private String supplierName;

    //detail

    private String cabName;

    private String workshopLocation;

    private String enterpriseName;

    private String checkCode;

    /**
     * 设备编号
     */
    @ExcelExport(value = "机台",sort = 50)
    private String deviceCode;

//    @ExcelExport(value = "是否盘验",sort = 11)
    private Boolean isCheck;

    /**
     * 备注
     */
    private String remark;


    private CabinetCargoSpace.SpaceNature spaceType;

    private String spaceTypeDesc;

    public String getSpaceTypeDesc(){
        if (spaceType!=null){
            return spaceType.getDesc();
        }
        return "";
    }

    @ExcelExport(value = "规格码",sort = 30)
    private String skuSpecOld;

    private String skuCodeOld;

    private StorageInventoryInout.BusinessDetailType businessDetailType;


    public String businessDetailTypeDesc;


    public String getBusinessDetailTypeDesc(){
        if (businessDetailType!=null){
            return businessDetailType.getDesc();
        }
        return "";
    }

    private StorageInventoryInout.BusinessTypePre businessTypePre;


    private String businessTypePreDesc;


    public String getBusinessTypePreDesc(){
        if (businessTypePre!=null){
            return businessTypePre.getDesc();
        }
        return "";
    }

    private Long useInventoryInoutId;

    private Long checkInventoryInoutId;

    private Long storageInventoryOutId;


    private Long workOrderId;


    private Long departmentId;
    @ExcelExport(value = "部门",sort = 72)
    private String departmentName;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    private BigDecimal total;

    private Long processId;

    private String roleName;

    @ExcelExport(value = "刀具条码",sort = 120)
    private String labelCode;

    @ExcelExport(value = "剩余寿命",sort = 150)
    private Integer remainingTime;

    @ExcelExport(value = "标准寿命",sort = 130)
    private Integer settingTime;

    @ExcelExport(value = "已使用寿命",sort = 140)
    private Integer haveBeenUsedTime;

    @ExcelExport(value = "寿命单位",sort = 160,kv = "minute-分钟;number-个数")
    private StorageInventoryInoutDetail.LifeUnit lifeUnit;

    private String lifeUnitDesc;


    public String getLifeUnitDesc(){
        if(this.lifeUnit!=null){
            return this.lifeUnit.getDesc();
        }
        return "";
    }
   /* @ExcelExport(value = "原因",sort = 110)
    private String causeName;*/

    //@ExcelExport(value = "刀具寿命",sort = 90)
    private String remainingSettingTime;


    private String lifeUnitName;

    private Integer quantityPackUnit;

    @ExcelExport(value = "数量(基础单位计)",sort = 112)
    private Integer quantityPack;

    private Long packId;
    @ExcelExport(value = "包装规格",sort = 101)
    private String packName;
    @ExcelExport(value = "基础单位",sort = 113)
    private String basicsUnitName;
    @ExcelExport(value = "成本中心",sort = 71)
    private String costCenter;


}
